package org.explugin.lang.parser.util;

import com.intellij.lang.PsiBuilder;

public class ParsingUtil {

    /**
     * Shows message and drops markerToDrop if psiBuilder reached end of file.
     * @param psiBuilder
     * @param message
     * @param markerToDrop
     * @return psiBuilder reached the end of file
     */
    protected static boolean checkBuilderEOF(PsiBuilder psiBuilder, String message, PsiBuilder.Marker markerToDrop) {
        if (psiBuilder.eof()) {
            psiBuilder.error(message);
            markerToDrop.drop();
            return true;
        }

        return false;
    }
}
